{% extends 'base.html' %}
{% load i18n %}
{% load static %}
{% load crispy_forms_tags %}

{% block head %}
  <link href="{% static 'css/login.css' %}" rel="stylesheet">
  <link href="{% static 'css/signup.css' %}" rel="stylesheet">
{% endblock head %}

{% block main %}
  <div class="cover" >
    <h1 class="logo"><a href="{% url 'home' %}">Community</a></h1>
    {% if form.non_field_errors %}
      {% for error in form.non_field_errors %}
        <div class="alert alert-danger alert-dismissable">
          <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
          {{ error }}
        </div>
      {% endfor %}
    {% endif %}
    <div class="signup">
      <h2>{% trans 'Log in' %}</h2>
      <form method="post" novalidate>
        {% csrf_token %}
        {% for field in form.visible_fields %}
          <div class="form-group{% if field.errors %} has-error{% endif %}">
            <label for="{{ field.label }}">{{ field.label }}</label>
            {{ field  }}
            {% if field.help_text %}
              <span class="help-block">{{ field.help_text|safe }}</span>
            {% endif %}
            {% for error in field.errors %}
              <label class="control-label">{{ error }}</label>
            {% endfor %}
          </div>
        {% endfor %}
        <button type="submit" class="btn btn-primary">Log in</button>
        <a href="{% url 'authentication:signup' %}" class="btn btn-link">
          {% trans 'Sign up' %}
        </a>
      </form>
    </div>
  </div>
{% endblock main %}
